# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Balló György <ballogyor+arch at gmail dot com>
# Contributor: WorMzy Tykashi <wormzy.tykashi@gmail.com>
# Contributor: Alois Nespor <info@aloisnespor.info>
# Contributor: speps <speps dot aur dot archlinux dot org>

pkgbase=rssguard
pkgname=(rssguard{,-lite})
pkgver=4.5.5
pkgrel=1
pkgdesc='Simple (yet powerful) Qt feed reader'
arch=(loong64 x86_64)
url='https://github.com/martinrotter/rssguard'
license=(GPL3)
makedepends=(cmake
             qt6-5compat
             qt6-multimedia
             qt6-tools
             qt6-webengine)
optdepends=('clang: Support for beautification of message filter scripts'
            'mariadb-libs: Support for MariaDB-based data storage')
source=(https://github.com/martinrotter/$pkgbase/archive/$pkgver/$pkgbase-$pkgver.tar.gz)
sha256sums=('9264f16ca323229730e896dd49f5d6ee8695207fc21a3b475e28ec9a0805c02f')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_WITH_QT6=ON
  cmake --build build

  cmake -B build-lite -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_WITH_QT6=ON \
    -DUSE_WEBENGINE=OFF
  cmake --build build-lite
}

package_rssguard() {
  depends=(gcc-libs
           glibc
           qt6-5compat
           qt6-base
           qt6-declarative
           qt6-multimedia
           qt6-webengine
           sqlite)

  DESTDIR="$pkgdir" cmake --install build
}

package_rssguard-lite() {
  pkgdesc+=' without WebEngine support'
  depends=(gcc-libs
           glibc
           qt6-5compat
           qt6-base
           qt6-declarative
           qt6-multimedia
           sqlite)
  conflicts=(rssguard)
  provides=(rssguard=$pkgver)
  replaces=(rssguard-nowebengine)

  DESTDIR="$pkgdir" cmake --install build-lite
}
